import request from '@/utils/request'

export function getSightList(params) {
  return request({
    url: '/sight',
    method: 'get',
    params
  })
}

export function getSightDetail(id) {
  return request({
    url: `/sight/${id}`,
    method: 'get'
  })
}

export function createSight(data) {
  return request({
    url: '/sight',
    method: 'post',
    data
  })
}

export function updateSight(id, data) {
  return request({
    url: `/sight/${id}`,
    method: 'put',
    data
  })
}

export function deleteSight(id) {
  return request({
    url: `/sight/${id}`,
    method: 'delete'
  })
}

export function toggleSightFavorite(id, isFavorite) {
  return request({
    url: `/sight/${id}/favorite`,
    method: isFavorite ? 'post' : 'delete'
  })
}

export function getTotalSights() {
  return request({
    url: '/sight/total/sights',
    method: 'get'
  })
}

// 获取热门景点
export function getHotSights() {
  return request({
    url: '/sight/hot/sight',
    method: 'get'
  })
}
